<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Array.of与数组创建的细节</title>
</head>
<body>
    <script>
        let arr = new Array('jkdsf');
        arr[4] = 'ghuy';
        console.log(arr);//中间没有数值的位置上自动补充undefined

        // 创建一个数组，长度为6，内容都是undefined
        let array = new Array(6);
        console.log(array);

        // 创建一个数组，里面只有一个元素是6
        let arr1 = Array.of(6);
        console.log(arr1);
    </script>
</body>
</html>